<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>DateTimePicker 日期时间选择器 | MyUI 4.x</title>
    <meta name="generator" content="VuePress 1.7.1">
    <link rel="icon" href="/my/favicon.ico">
    <script>
      var _hmt = _hmt || [];
      (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?c4e5f73318b5cb0c389e3d9a05f831cc";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>
    <meta name="description" content="MyUI是美亚柏科旗下新德汇出品的Web前端一站式项目工程框架，专注于公检法行业中台系统快速搭建，框架已在多个项目实战检验。">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">
    
    <link rel="preload" href="/my/assets/css/0.styles.82a18d97.css" as="style"><link rel="preload" href="/my/assets/js/app.fc4964fc.js" as="script"><link rel="preload" href="/my/assets/js/513.edb84f11.js" as="script"><link rel="preload" href="/my/assets/js/1335.ae41b76f.js" as="script"><link rel="preload" href="/my/assets/js/958.935c6658.js" as="script">
    <link rel="stylesheet" href="/my/assets/css/0.styles.82a18d97.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/my/" class="home-link router-link-active"><img src="/my/img/logo.png" alt="MyUI 4.x" class="logo"> <span class="site-name can-hide">MyUI 4.x</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/my/guide/" class="nav-link">
  指南
</a></div><div class="nav-item"><a href="/my/ui/components/" class="nav-link">
  组件
</a></div><div class="nav-item"><a href="/my/ui/charts/" class="nav-link">
  图表
</a></div><div class="nav-item"><a href="/my/ui/map/" class="nav-link">
  地图
</a></div><div class="nav-item"><a href="/my/ui/go/" class="nav-link">
  关系图
</a></div><div class="nav-item"><a href="/my/ui/icon/" class="nav-link">
  图标
</a></div><div class="nav-item"><a href="/my/ui/pages/" class="nav-link">
  页面
</a></div><div class="nav-item"><a href="http://newgateway.gitee.io/my-web/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  演示
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="JSDoc" class="dropdown-title"><span class="title">JSDoc</span> <span class="arrow down"></span></button> <button type="button" aria-label="JSDoc" class="mobile-dropdown-title"><span class="title">JSDoc</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/my/api/components.html" class="nav-link">
  基础组件
</a></li><li class="dropdown-item"><!----> <a href="/my/api/utils.html" class="nav-link">
  工具函数
</a></li><li class="dropdown-item"><!----> <a href="/my/api/charts.html" class="nav-link">
  图表组件
</a></li><li class="dropdown-item"><!----> <a href="/my/api/map.html" class="nav-link">
  地图组件
</a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/my/guide/" class="nav-link">
  指南
</a></div><div class="nav-item"><a href="/my/ui/components/" class="nav-link">
  组件
</a></div><div class="nav-item"><a href="/my/ui/charts/" class="nav-link">
  图表
</a></div><div class="nav-item"><a href="/my/ui/map/" class="nav-link">
  地图
</a></div><div class="nav-item"><a href="/my/ui/go/" class="nav-link">
  关系图
</a></div><div class="nav-item"><a href="/my/ui/icon/" class="nav-link">
  图标
</a></div><div class="nav-item"><a href="/my/ui/pages/" class="nav-link">
  页面
</a></div><div class="nav-item"><a href="http://newgateway.gitee.io/my-web/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  演示
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="JSDoc" class="dropdown-title"><span class="title">JSDoc</span> <span class="arrow down"></span></button> <button type="button" aria-label="JSDoc" class="mobile-dropdown-title"><span class="title">JSDoc</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/my/api/components.html" class="nav-link">
  基础组件
</a></li><li class="dropdown-item"><!----> <a href="/my/api/utils.html" class="nav-link">
  工具函数
</a></li><li class="dropdown-item"><!----> <a href="/my/api/charts.html" class="nav-link">
  图表组件
</a></li><li class="dropdown-item"><!----> <a href="/my/api/map.html" class="nav-link">
  地图组件
</a></li></ul></div></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Basic</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>Form</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/my/element/cascader.html" class="sidebar-link">Cascader 级联选择器</a></li><li><a href="/my/element/checkbox.html" class="sidebar-link">Checkbox 多选框</a></li><li><a href="/my/element/color-picker.html" class="sidebar-link">ColorPicker 颜色选择器</a></li><li><a href="/my/element/date-picker.html" class="sidebar-link">DatePicker 日期选择器</a></li><li><a href="/my/element/datetime-picker.html" aria-current="page" class="active sidebar-link">DateTimePicker 日期时间选择器</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/my/element/datetime-picker.html#日期和时间点" class="sidebar-link">日期和时间点</a></li><li class="sidebar-sub-header"><a href="/my/element/datetime-picker.html#日期和时间范围" class="sidebar-link">日期和时间范围</a></li><li class="sidebar-sub-header"><a href="/my/element/datetime-picker.html#默认的起始与结束时刻" class="sidebar-link">默认的起始与结束时刻</a></li><li class="sidebar-sub-header"><a href="/my/element/datetime-picker.html#attributes" class="sidebar-link">Attributes</a></li><li class="sidebar-sub-header"><a href="/my/element/datetime-picker.html#picker-options" class="sidebar-link">Picker Options</a></li><li class="sidebar-sub-header"><a href="/my/element/datetime-picker.html#shortcuts" class="sidebar-link">Shortcuts</a></li><li class="sidebar-sub-header"><a href="/my/element/datetime-picker.html#events" class="sidebar-link">Events</a></li><li class="sidebar-sub-header"><a href="/my/element/datetime-picker.html#methods" class="sidebar-link">Methods</a></li><li class="sidebar-sub-header"><a href="/my/element/datetime-picker.html#slots" class="sidebar-link">Slots</a></li></ul></li><li><a href="/my/element/form.html" class="sidebar-link">Form 表单</a></li><li><a href="/my/element/input.html" class="sidebar-link">Input 输入框</a></li><li><a href="/my/element/input-number.html" class="sidebar-link">InputNumber 计数器</a></li><li><a href="/my/element/radio.html" class="sidebar-link">Radio 单选框</a></li><li><a href="/my/element/rate.html" class="sidebar-link">Rate 评分</a></li><li><a href="/my/element/select.html" class="sidebar-link">Select 选择器</a></li><li><a href="/my/element/slider.html" class="sidebar-link">Slider 滑块</a></li><li><a href="/my/element/switch.html" class="sidebar-link">Switch 开关</a></li><li><a href="/my/element/time-picker.html" class="sidebar-link">TimePicker 时间选择器</a></li><li><a href="/my/element/transfer.html" class="sidebar-link">Transfer 穿梭框</a></li><li><a href="/my/element/upload.html" class="sidebar-link">Upload 上传</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Data</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Notice</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Navigation</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Others</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="datetimepicker-日期时间选择器"><a href="#datetimepicker-日期时间选择器" class="header-anchor">#</a> DateTimePicker 日期时间选择器</h1> <p>在同一个选择器里选择日期和时间</p> <div class="custom-block tip"><p class="custom-block-title">TIP</p> <p>DateTimePicker 由 DatePicker 和 TimePicker 派生，<code>Picker Options</code> 或者其他选项可以参照 DatePicker 和 TimePicker。</p></div> <h2 id="日期和时间点"><a href="#日期和时间点" class="header-anchor">#</a> 日期和时间点</h2> <!----><h2 id="日期和时间范围"><a href="#日期和时间范围" class="header-anchor">#</a> 日期和时间范围</h2> <!----><h2 id="默认的起始与结束时刻"><a href="#默认的起始与结束时刻" class="header-anchor">#</a> 默认的起始与结束时刻</h2> <!----><h2 id="attributes"><a href="#attributes" class="header-anchor">#</a> Attributes</h2> <table><thead><tr><th>参数</th> <th>说明</th> <th>类型</th> <th>可选值</th> <th>默认值</th></tr></thead> <tbody><tr><td>value / v-model</td> <td>绑定值</td> <td>date(DateTimePicker) / array(DateTimeRangePicker)</td> <td>—</td> <td>—</td></tr> <tr><td>readonly</td> <td>完全只读</td> <td>boolean</td> <td>—</td> <td>false</td></tr> <tr><td>disabled</td> <td>禁用</td> <td>boolean</td> <td>—</td> <td>false</td></tr> <tr><td>editable</td> <td>文本框可输入</td> <td>boolean</td> <td>—</td> <td>true</td></tr> <tr><td>clearable</td> <td>是否显示清除按钮</td> <td>boolean</td> <td>—</td> <td>true</td></tr> <tr><td>size</td> <td>输入框尺寸</td> <td>string</td> <td>large, small, mini</td> <td>—</td></tr> <tr><td>placeholder</td> <td>非范围选择时的占位内容</td> <td>string</td> <td>—</td> <td>—</td></tr> <tr><td>start-placeholder</td> <td>范围选择时开始日期的占位内容</td> <td>string</td> <td>—</td> <td>—</td></tr> <tr><td>end-placeholder</td> <td>范围选择时结束日期的占位内容</td> <td>string</td> <td>—</td> <td>—</td></tr> <tr><td>time-arrow-control</td> <td>是否使用箭头进行时间选择</td> <td>boolean</td> <td>—</td> <td>false</td></tr> <tr><td>type</td> <td>显示类型</td> <td>string</td> <td>year/month/date/week/ datetime/datetimerange/daterange</td> <td>date</td></tr> <tr><td>format</td> <td>显示在输入框中的格式</td> <td>string</td> <td>见<a href="#/zh-CN/component/date-picker#ri-qi-ge-shi">日期格式</a></td> <td>yyyy-MM-dd HH:mm:ss</td></tr> <tr><td>align</td> <td>对齐方式</td> <td>string</td> <td>left, center, right</td> <td>left</td></tr> <tr><td>popper-class</td> <td>DateTimePicker 下拉框的类名</td> <td>string</td> <td>—</td> <td>—</td></tr> <tr><td>picker-options</td> <td>当前时间日期选择器特有的选项参考下表</td> <td>object</td> <td>—</td> <td>{}</td></tr> <tr><td>range-separator</td> <td>选择范围时的分隔符</td> <td>string</td> <td>-</td> <td>'-'</td></tr> <tr><td>default-value</td> <td>可选，选择器打开时默认显示的时间</td> <td>Date</td> <td>可被<code>new Date()</code>解析</td> <td>—</td></tr> <tr><td>default-time</td> <td>选中日期后的默认具体时刻</td> <td>非范围选择时：string / 范围选择时：string[]</td> <td>非范围选择时：形如<code>12:00:00</code>的字符串；范围选择时：数组，长度为 2，每项值为字符串，形如<code>12:00:00</code>，第一项指定开始日期的时刻，第二项指定结束日期的时刻。不指定会使用时刻 <code>00:00:00</code></td> <td>—</td></tr> <tr><td>value-format</td> <td>可选，绑定值的格式。不指定则绑定值为 Date 对象</td> <td>string</td> <td>见<a href="#/zh-CN/component/date-picker#ri-qi-ge-shi">日期格式</a></td> <td>—</td></tr> <tr><td>name</td> <td>原生属性</td> <td>string</td> <td>—</td> <td>—</td></tr> <tr><td>unlink-panels</td> <td>在范围选择器里取消两个日期面板之间的联动</td> <td>boolean</td> <td>—</td> <td>false</td></tr> <tr><td>prefix-icon</td> <td>自定义头部图标的类名</td> <td>string</td> <td>—</td> <td>el-icon-date</td></tr> <tr><td>clear-icon</td> <td>自定义清空图标的类名</td> <td>string</td> <td>—</td> <td>el-icon-circle-close</td></tr></tbody></table> <h2 id="picker-options"><a href="#picker-options" class="header-anchor">#</a> Picker Options</h2> <table><thead><tr><th>参数</th> <th>说明</th> <th>类型</th> <th>可选值</th> <th>默认值</th></tr></thead> <tbody><tr><td>shortcuts</td> <td>设置快捷选项，需要传入 { text, onClick } 对象用法参考 demo 或下表</td> <td>Object[]</td> <td>—</td> <td>—</td></tr> <tr><td>disabledDate</td> <td>设置禁用状态，参数为当前日期，要求返回 Boolean</td> <td>Function</td> <td>—</td> <td>—</td></tr> <tr><td>cellClassName</td> <td>设置日期的 className</td> <td>Function(Date)</td> <td>—</td> <td>—</td></tr> <tr><td>firstDayOfWeek</td> <td>周起始日</td> <td>Number</td> <td>1 到 7</td> <td>7</td></tr></tbody></table> <h2 id="shortcuts"><a href="#shortcuts" class="header-anchor">#</a> Shortcuts</h2> <table><thead><tr><th>参数</th> <th>说明</th> <th>类型</th> <th>可选值</th> <th>默认值</th></tr></thead> <tbody><tr><td>text</td> <td>标题文本</td> <td>string</td> <td>—</td> <td>—</td></tr> <tr><td>onClick</td> <td>选中后的回调函数，参数是 vm，可通过触发 'pick' 事件设置选择器的值。例如 vm.$emit('pick', new Date())</td> <td>function</td> <td>—</td> <td>—</td></tr></tbody></table> <h2 id="events"><a href="#events" class="header-anchor">#</a> Events</h2> <table><thead><tr><th>Event Name</th> <th>Description</th> <th>Parameters</th></tr></thead> <tbody><tr><td>change</td> <td>用户确认选定的值时触发</td> <td>组件绑定值。格式与绑定值一致，可受 <code>value-format</code> 控制</td></tr> <tr><td>blur</td> <td>当 input 失去焦点时触发</td> <td>组件实例</td></tr> <tr><td>focus</td> <td>当 input 获得焦点时触发</td> <td>组件实例</td></tr></tbody></table> <h2 id="methods"><a href="#methods" class="header-anchor">#</a> Methods</h2> <table><thead><tr><th>方法名</th> <th>说明</th> <th>参数</th></tr></thead> <tbody><tr><td>focus</td> <td>使 input 获取焦点</td> <td>—</td></tr></tbody></table> <h2 id="slots"><a href="#slots" class="header-anchor">#</a> Slots</h2> <table><thead><tr><th>Name</th> <th>说明</th></tr></thead> <tbody><tr><td>range-separator</td> <td>自定义分隔符</td></tr></tbody></table></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/my/element/date-picker.html" class="prev">
        DatePicker 日期选择器
      </a></span> <span class="next"><a href="/my/element/form.html">
        Form 表单
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"></div></div>
    <script src="/my/assets/js/app.fc4964fc.js" defer></script><script src="/my/assets/js/513.edb84f11.js" defer></script><script src="/my/assets/js/1335.ae41b76f.js" defer></script><script src="/my/assets/js/958.935c6658.js" defer></script>
  </body>
</html>
